import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';


export const querySchema: FormSchemaGetter = () => [
  {
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
    fieldName: 'date',
    label: '日期',
  },
  {
    component: 'Input',
    fieldName: 'income',
    label: '收入',
  },
  {
    component: 'Input',
    fieldName: 'expense',
    label: '支出',
  },
  {
    component: 'Input',
    fieldName: 'profit',
    label: '利润',
  },
  {
    component: 'Input',
    fieldName: 'assets',
    label: '资产',
  },
  {
    component: 'Input',
    fieldName: 'liabilities',
    label: '负债',
  },
  {
    component: 'Input',
    fieldName: 'cashFlow',
    label: '现金流',
  },
];

export const columns: VxeGridProps['columns'] = [
  {
    title: '日期',
    field: 'date',
  },
  {
    title: '收入',
    field: 'income',
  },
  {
    title: '支出',
    field: 'expense',
  },
  {
    title: '利润',
    field: 'profit',
  },
  {
    title: '资产',
    field: 'assets',
  },
  {
    title: '负债',
    field: 'liabilities',
  },
  {
    title: '现金流',
    field: 'cashFlow',
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 180,
  },
];

export const drawerSchema: FormSchemaGetter = () => [
  {
    label: '主键ID',
    fieldName: 'id',
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
  },
  {
    label: '日期',
    fieldName: 'date',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
    rules: 'required',
  },
  {
    label: '收入',
    fieldName: 'income',
    component: 'InputNumber',
    suffix: () => '¥',
    rules: 'required',
  },
  {
    label: '支出',
    fieldName: 'expense',
    component: 'InputNumber',
    suffix: () => '¥',
    rules: 'required',
  },
  {
    label: '利润',
    fieldName: 'profit',
    component: 'InputNumber',
    suffix: () => '¥',
    rules: 'required',
  },
  {
    label: '资产',
    fieldName: 'assets',
    component: 'InputNumber',
    suffix: () => '¥',
    rules: 'required',
  },
  {
    label: '负债',
    fieldName: 'liabilities',
    component: 'InputNumber',
    suffix: () => '¥',
    rules: 'required',
  },
  {
    label: '现金流',
    fieldName: 'cashFlow',
    component: 'InputNumber',
    suffix: () => '¥',
    rules: 'required',
  },
  {
    label: '备注',
    fieldName: 'remark',
    component: 'Textarea',
  },
];
